package loan.calc.constant.dict;

import lombok.AllArgsConstructor;
import lombok.Getter;
import loan.calc.constant.dict.base.BaseDictEnum;
import loan.calc.constant.dict.base.DictEnum;

/**
 * 还款方式
 */
@Getter
@DictEnum(value = "RepayMethod", description = "还款方式")
@AllArgsConstructor
public enum RepayMethodDictEnum implements BaseDictEnum {

    EQ_PI("等额本息",
            BaseAmountTypeForInstalmentInterestDictEnum.NORMAL_BALANCE,
            PeriodSplitModeDictEnum.BEFORE_MONTH_THEN_DAY),

    EQ_P("等额本金",
            BaseAmountTypeForInstalmentInterestDictEnum.NORMAL_BALANCE,
            PeriodSplitModeDictEnum.BEFORE_MONTH_THEN_DAY),

    PERIOD_I_ONCE_P(
            "按期付息一次还本",
            BaseAmountTypeForInstalmentInterestDictEnum.NORMAL_BALANCE,
            PeriodSplitModeDictEnum.ONLY_DAY
    ),

    ONCE_P_I(
            "一次性还本付息",
            BaseAmountTypeForInstalmentInterestDictEnum.NORMAL_BALANCE,
            PeriodSplitModeDictEnum.ONLY_DAY
    ),

    SEGMENT(
            "分段组合方式（即在不同的时间段使用以上四种还款方式组合而成的还款方式）",
            BaseAmountTypeForInstalmentInterestDictEnum.NORMAL_BALANCE,
            PeriodSplitModeDictEnum.BEFORE_MONTH_THEN_DAY
    )
    ;

    private final String value;

    private final String description;

    /**
     * 计算期供利息计息基础金额类型
     */
    private final BaseAmountTypeForInstalmentInterestDictEnum baseAmountTypeForInstalmentInterest;

    /**
     * 周期内利息计算，时间区段分割月天方式枚举
     */
    private final PeriodSplitModeDictEnum periodSplitMode;

    RepayMethodDictEnum(String description,
                        BaseAmountTypeForInstalmentInterestDictEnum baseAmountTypeForInstalmentInterest,
                        PeriodSplitModeDictEnum periodSplitMode) {
        this.value = name();
        this.description = description;
        this.baseAmountTypeForInstalmentInterest = baseAmountTypeForInstalmentInterest;
        this.periodSplitMode = periodSplitMode;
    }

}
